﻿@model ProgrammingSchool.Models.Shared.FeedBackModel
@{
    Layout = "";
}
<script type="text/javascript">
    $(document).ready(function () {
        $('#resetFeedBack').click(function () {
            $('#fmFeedBack').find('input,textarea').each(function () {
                $(this).val($(this).attr('rel'));
            });
            return true;
        });
        $('#fmFeedBack').find('input,textarea').focus(function () {
            var el = $(this);
            if (el.attr('rel') == el.val())
                el.val("");
        });
        $('#fmFeedBack').find('input,textarea').focusout(function () {
            var el = $(this);
            if (jQuery.trim(el.val()) == "")
                el.val(el.attr('rel'));
        });
    });
</script>
@using (Ajax.BeginForm("FeedBack", "Home", null, new AjaxOptions() { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "sideRight", OnSuccess="alert('Thanks for your feedback!');" }, new { id = "fmFeedBack" }))
{
    <div class="feedback_name">
        <span>Feedback</span>
    </div>
    <div class="feedback_input">
        @Html.TextBoxFor(m => m.Name, new { rel = "Your name" })
    </div>
    <div class="feedback_input">
        @Html.TextBoxFor(m => m.Phone, new { rel = "Your phone" })
    </div>
    <div class="feedback_input">
        @Html.TextBoxFor(m => m.Email, new { rel = "E-mail" })
    </div>
    <div class="feedback_textarea">
        @Html.TextAreaFor(m => m.Message, new { rel = "Message" })
    </div>
    <div class="errorMessage">
        <span>@Html.ValidationSummary()</span>
    </div>
    <div class="feedback_submit">
        <a href="javascript:void();" onclick="$('#fmFeedBack').submit();"><span>Submit</span></a>
    </div>
    <div class="feedback_clear">
        <a href="javascript:void();" id='resetFeedBack'><span>Clear</span></a>
    </div>
}